import { reqGoodInfo } from '@/api'
import { getUUID } from '@/utils'
const state = {
    goodinfo: {
        data: {
        }
    },
    //用户临时id
    uuid_token: getUUID()
}
const actions = {
    //获取商品信息
    async goodInfo({ commit }, skuId) {
        let result = await reqGoodInfo(skuId)
        if (result.code == 200) {
            commit('GOODINFO', result.data)
        }
    }
}
const mutations = {
    GOODINFO(state, data) {
        state.goodinfo = data
    }
}
const getters = {
    categoryView(state) {
        return state.goodinfo.categoryView;
    },
    skuInfo(state) {
        return state.goodinfo.skuInfo || {};
    },
    spuSaleAttrList(state) {
        return state.goodinfo.spuSaleAttrList
    }
}
export default {
    state, mutations, actions, getters
}
